home *** CD-ROM | disk | FTP | other *** search
- Path: anvil.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: malloc() problem
- Date: 27 Feb 1996 15:35:49 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4h04glINNert@anvil.ugrad.cs.ubc.ca>
- References: <31332992.41C6@mashie.ece.jhu.edu>
- NNTP-Posting-Host: anvil.ugrad.cs.ubc.ca
-
- In article <31332992.41C6@mashie.ece.jhu.edu>,
- Chenyang Xu <chenyang@mashie.ece.jhu.edu> wrote:
- >Hi, there,
- >
- > Recently I have been haunted by the core dump inside malloc() on SGI
- >Indigo2 IRIX5.2, I know the problem is caused by my program not the
- >malloc(). But I couldn't find the bug? Does any C expert has identified
- >the common reasons for malloc to core dump? Your help will probably help
- >me to find the bug. Thank you very much!
-
- Use a Malloc debugger. Try ElectricFence. It was developed a number of years
- ago at Pixar. It works under an assortment of UNIX operating systems.
-
- It works by replacing the malloc() routines with its own routines which place
- protected pages around allocation blocks. When your program overruns the
- boundaries of a block, it causes a segmentation violation immediately, so you
- know where the _real_ error happens.
-
- I learned about ElectricFence one morning at 6:00 am after I spent the whole
- night chasing a pointer bug. I untarred the thing, compiled it, linked the
- "libefence.a" library to my program and found the bug in three seconds.
-
- When your program is linked with EF, you can control through environment
- variables whether the ends of blocks are aligned on page boundaries or the
- beginnings, to detect overruns or underruns precisely (can't do both,
- obviously). You can also arrange for all free()d memory to be protected---this
- can use a lot of virtual memory on your machine!
- --
-
-